#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h> 

static const BUFFERSIZE = 256;
static const INIT = 1;
static const START = 2;
static const REQUESTUPDATE = 3;
static const UPDATE = 4;
static const HALLCALL = 5;

/*------------------------------------------
Message Protocols
INIT - ID(byte)
START - no other arguments
REQUESTUPDATE - no other arguments
UPDATE - ID(byte), CURRENTFLOOR(byte), NEXTFLOOR(byte), DESTINATIONCOUNT(byte), DESTINATIONS(byte[])
HALLCALL - FLOORNUMBER(byte)
--------------------------------------------*/

char * init(char *buffer, int id){
	bzero(buffer,BUFFERSIZE);
	buffer[0] = (char) INIT;
	buffer[1] = (char) id;
	buffer[2] = '\n';
	//buffer[3] = '\0';
}
char * start(char *buffer){
	bzero(buffer,BUFFERSIZE);
	buffer[0] = START;
}
char * requestUpdate(char *buffer){
	bzero(buffer,BUFFERSIZE);
	buffer[0] = REQUESTUPDATE;
}
char * update(char *buffer, int id){
	bzero(buffer,BUFFERSIZE);	
	buffer[0] = (char) UPDATE;
	buffer[1] = (char) id;
	buffer[2] = '\n';
	
}

char * hallcall(char *buffer, int floor){
	bzero(buffer,BUFFERSIZE);	
	buffer[0] = UPDATE;
	buffer[1] = floor;
}
